package cn.micro.system.manage.entity;
import cn.micro.system.manage.common.vaildate.ValidateGroup;
import cn.micro.system.manage.entity.base.BaseEntity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.List;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 组织机构
 * </p>
 *
 * @author wr
 * @since 2023-12-25
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysDimDept extends BaseEntity {

    private static final long serialVersionUID = 1L;


    /**
     * 部门名称
     */
    @NotEmpty(message = "部门名称不能为空", groups = {ValidateGroup.add.class})
    private String name;

    /**
     * 上级部门id
     */
    @NotNull(message = "上级部门id不能为空", groups = {ValidateGroup.add.class})
    private Long parentId;

    /**
     * 树结构
     */
    private String treePath;

    /**
     * 排序
     */
    private Integer sortValue;

    /**
     * 负责人
     */
    @NotEmpty(message = "负责人不能为空", groups = {ValidateGroup.add.class})
    private String leader;

    /**
     * 电话
     */
    @NotEmpty(message = "电话不能为空", groups = {ValidateGroup.add.class})
    private String phone;

    /**
     * 状态（1正常 0停用）
     */
    @NotNull(message = "状态不能为空", groups = {ValidateGroup.add.class})
    @Range(message = "状态值超出有效范围",min = 0,max  =1, groups = {ValidateGroup.add.class,ValidateGroup.edit.class})
    private Integer status;


    // 下级列表
    @TableField(exist = false)
    private List<SysDimDept> children;

    //角色ID列表
    @TableField(exist = false)
    private List<String> roleIds;


    public static final String ID = "id";

    public static final String NAME = "name";

    public static final String PARENT_ID = "parent_id";

    public static final String TREE_PATH = "tree_path";

    public static final String SORT_VALUE = "sort_value";

    public static final String LEADER = "leader";

    public static final String PHONE = "phone";

    public static final String STATUS = "status";

    public static final String CREATE_TIME = "create_time";

    public static final String UPDATE_TIME = "update_time";

    public static final String IS_DELETED = "is_deleted";

}
